package classes.managers {
	import classes.buttons.BaseButton;
	import classes.global.Global_Properties;
	import classes.scenes.A_Scene;
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	/**
	 * ...
	 * @author Kihoonee
	 */
	public class CoinAni_Manager extends A_Scene {
		
		// 부모클래스
		//private var main:Main;
		//private var mc:MovieClip;
		
		private var rankBtn:BaseButton;
		
		public function CoinAni_Manager( _main:Main, _mc:MovieClip ) {
			super( _main, _mc );
			
			addEvent();
		}
		
		public function init():void {
			rankBtn.visible = false;
			
			mc.coinAni_mc.gotoAndStop(1);
		}
		
		public function getCoin( _coin:int ):void {
			switch ( _coin ) { 
				// 추가 보상
				case 0: mc.coinAni_mc.gotoAndPlay("매우불만"); Global_Properties.coin += 10;
				break;
				case 1: mc.coinAni_mc.gotoAndPlay("불만"); Global_Properties.coin += 20;
				break;
				case 2: mc.coinAni_mc.gotoAndPlay("불만"); Global_Properties.coin += 30;
				break;
				case 3: mc.coinAni_mc.gotoAndPlay("보통"); Global_Properties.coin += 50;
				break;
				case 4: mc.coinAni_mc.gotoAndPlay("보통"); Global_Properties.coin += 50;
				break;
				case 5: mc.coinAni_mc.gotoAndPlay("보통"); Global_Properties.coin += 50;
				break;
				case 6: mc.coinAni_mc.gotoAndPlay("보통"); Global_Properties.coin += 50;
				break;
				case 7: mc.coinAni_mc.gotoAndPlay("보통"); Global_Properties.coin += 50;
				break;
				case 8: mc.coinAni_mc.gotoAndPlay("만족"); Global_Properties.coin += 60;
				break;
				case 9: mc.coinAni_mc.gotoAndPlay("매우만족"); Global_Properties.coin += 80;
				break;
				case 10: mc.coinAni_mc.gotoAndPlay("매우만족"); Global_Properties.coin += 100;
				break;
				default:
			}
			
			mc.coinAni_mc.coin_txt.text = Global_Properties.coin;
		}
		
		private function addEvent():void {
			rankBtn = new BaseButton( mc.rank_btn );
			mc.coinAni_mc.addEventListener( "coinAni_END", coinAni_END );
		}
		
		private function coinAni_END(e:Event):void {
			rankBtn.addEventListener( MouseEvent.CLICK, BtnEvent );
			rankBtn.visible = true;
		}
		
		private function BtnEvent(e:MouseEvent):void {
			rankBtn.removeEventListener( MouseEvent.CLICK, BtnEvent );
			switch ( e.target.name ) {
				case "rank_btn": trace("rankBtn")
					rankView();
				break;
				default:
			}
		}
		
		private function rankView():void {
			trace("rankView")
			main.rankInit();
		}
		
		
	}

}